<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

// @filename   Mmessage.php

class Mmessage extends Model {

    function Mmessage() {
        parent::Model();
    }

    function insert_new_message($values) {
        return $this->db->insert('message',$values);
    }

    function get_message_count() {
    	$this->db->where('state',1);
    	return $this->db->count_all_results('message');
    }

    function get_message_list($offset,$limit) {
        $this->db->limit($limit,$offset);
        $this->db->order_by('id','desc');
        $query = $this->db->get_where('message',array('state'=>1));
        return $query->result_array();
    }
    
    function get_message_info($id){
        $query = $this->db->get_where('message',array('id'=>$id));
        return $query->row_array();
    }
    
    function update_message_data($id,$data){
    	return $this->db->update('message',$data,array('id'=>$id));
    }


}

?>